package net.bwie;


import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.table.api.TableResult;
import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;

public class 草稿 {
    public static void main(String[] args) throws Exception {

        StreamExecutionEnvironment evn = StreamExecutionEnvironment.getExecutionEnvironment();
        evn.setParallelism(1);

        StreamTableEnvironment tenv = StreamTableEnvironment.create(evn);


        TableResult tableResult = tenv.executeSql("SELECT\n" +
                "TUMBLE_START(time_ltz,INTERVAL '1' second) as stt,\n" +
                "TUMBLE_EHD(time_ltz,INTERVAL '1' second) as edt,\n" +



                        "sum(if(ctype = '驶入' ,1,0)) as card_cnt,\n" +
                        "sum(if(ctype = '驶出' ,1,0)) as pw_cnt\n" +

                        "FROM (TUMBLE(TABLE dwd_summary_cars_log, DESCRIPTOR(opTime), INTERVAL '3' MINUTES)) a1  \n" +
                        "GROUP BY stt,edt;\n"
        );











    }
}
